package yl.hs.bmipfull.controllers.chart;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import yl.hs.bmipfull.controllers.ControllerBase;
import yl.hs.bmipfull.daos.production.IProductionTaskDao;
import yl.hs.bmipfull.service.chart.IProductionChartService;
import yl.hs.bmipfull.service.chart.ISaleChartService;
import yl.hs.bmipfull.viewmodels.WebResult;

/**
 * @author 谢东
 * @apiNote
 * @since 2022-03-16 10:53 创建
 */
@Api(value = "图表中心-生产web接口",tags = "图表中心-生产")
@RestController
@RequestMapping(value = "/api/ProductionChart")
public class ProductionChartController extends ControllerBase {
    @Autowired
    ISaleChartService saleChartService;

    @Autowired
    IProductionChartService productionChartService;


    @ApiOperation(value = "未完成的订单-全部", notes = "未完成的订单-全部")
    @RequestMapping(value = "/getUntreatedOrder",method = RequestMethod.GET)
    public WebResult getUntreatedOrder(){
        return  success("查询成功",saleChartService.getUntreatedOrder(1));
    }
    @ApiOperation(value = "获取计划量", notes = "获取计划量")
    @RequestMapping(value = "/getPlanQuantity/{type}/{productCateSn}",method = RequestMethod.GET)
    public WebResult getPlanQuantity(@ApiParam(value = "时间类型") @PathVariable int type,
                                     @ApiParam(value = "产品编号") @PathVariable(required = false) String productCateSn){
        return  success("查询成功",productionChartService.getPlanQuantity(type,productCateSn));
    }
    @ApiOperation(value = "获取生产量", notes = "获取生产量")
    @RequestMapping(value = "/DeliveringAmount/{type}/{productCateSn}",method = RequestMethod.GET)
    public WebResult getDeliveringAmount(@ApiParam(value = "时间类型") @PathVariable int type,
                                     @ApiParam(value = "产品编号") @PathVariable(required = false) String productCateSn){
        return  success("查询成功",productionChartService.getDeliveringAmount(type,productCateSn));
    }
    @ApiOperation(value = "获取未设配比数量", notes = "获取未设配比数量")
    @RequestMapping(value = "/NoProportioning",method = RequestMethod.GET)
    public WebResult getNoProportioning(){
        return  success("查询成功",productionChartService.getNoProportioning());
    }

    @ApiOperation(value = "获取工地生产程度", notes = "获取工地生产程度")
    @RequestMapping(value = "/SiteProductionDegree",method = RequestMethod.GET)
    public WebResult getSiteProductionDegree(){
        return  success("查询成功",productionChartService.getSiteProductionDegree());
    }
    @ApiOperation(value = "本月产品发货量接口", notes = "本月产品发货量接口")
    @RequestMapping(value = "/productbymonth",method = RequestMethod.GET)
    public WebResult getProductByMonth(){
        return success("查询成功",productionChartService.getProductByMonth());
    }
    @ApiOperation(value = "产品本月工地发货量", notes = "产品本月工地发货量")
    @RequestMapping(value = "/getproductprojectbymonth",method = RequestMethod.GET)
    public WebResult getProductProjectByMonth(){
        return success("查询成功",productionChartService.getProductProjectByMonth());
    }
    @ApiOperation(value = "产品线产销量曲线（日周月）", notes = "产品线产量销量曲线（日周月）")
    @RequestMapping(value = "/ProductionLineSalesVolumeAndOutput/{dateType}/{productCateSn}",method = RequestMethod.GET)
    public WebResult getProductionLineSalesVolumeAndOutput(@ApiParam(value = "时间类型") @PathVariable int dateType,
                                         @ApiParam(value = "产品编号") @PathVariable(required = false) String productCateSn){
        return  success("查询成功",productionChartService.getProductionLineSalesVolumeAndOutput(dateType,productCateSn));
    }
    @ApiOperation(value = "产品产量/销量曲线", notes = "产品产量/销量曲线")
    @RequestMapping(value = "/getproductsalescurve/{type}/{productCateSn}",method = RequestMethod.GET)
    public WebResult getProductSalesCurve(@ApiParam(value = "时间类型") @PathVariable int type,@ApiParam(value = "产品编号") @PathVariable String productCateSn

                                          ){
        return success("查询成功",productionChartService.getProductSalesCurve(productCateSn,type));
    }
}
